package com.youkol.iot.demo.emqx;

import java.time.LocalDateTime;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import lombok.extern.slf4j.Slf4j;

@SpringBootApplication
@Slf4j
public class EmqxDemoApplication implements ApplicationRunner {

    @Autowired
    private ConfigurableApplicationContext context;

    public static void main(String[] args) {
        SpringApplication.run(EmqxDemoApplication.class, args);
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        if (context.isActive()) {
            log.info("                                  ");
            log.info(" _____  ______ __  __  ____       ");
            log.info("|  __ \\|  ____|  \\/  |/ __ \\   ");
            log.info("| |  | | |__  | \\  / | |  | |    ");
            log.info("| |  | |  __| | |\\/| | |  | |    ");
            log.info("| |__| | |____| |  | | |__| |     ");
            log.info("|_____/|______|_|  |_|\\____/     ");
            log.info("                                  ");
            log.info("YOUKOL :: EMQX DEMO has been started, time: " + LocalDateTime.now());

        }
    }
}
